<template>
  <top></top>
  <div class="content">
    <aside v-show="menuVisible">
      <h1>文档</h1>
      <ol>
        <li><router-link to="/doc/Intro">介绍</router-link></li>
        <!-- <li><router-link to="/doc/Install">安装</router-link></li>
        <li><router-link to="/doc/Start">开始</router-link></li> -->
      </ol>
      <h1>组件列表</h1>
      <ol>
        <li><router-link to="/doc/switch">Switch11</router-link></li>
        <li><router-link to="/doc/button">Button</router-link></li>
        <li><router-link to="/doc/dialog">Dialog</router-link></li>
        <li><router-link to="/doc/tabs">Tabs</router-link></li>
        <li><router-link to="/doc/Carousel">Carousel</router-link></li>
      </ol>
      <h1>未完待续...</h1>
    </aside>
    <main>
      <router-view />
    </main>
  </div>
</template>
<script lang="ts">
import top from "./components/top.vue";
import { defineComponent, inject, Ref } from "vue";
import { useRouter } from "vue-router";
export default {
  components: {
    top,
  },
  setup() {
    const router = useRouter();
    const menuVisible = inject<Ref<boolean>>("menuVisible");
    const close = () => {
      console.log(1);
    };
    const to = (name) => {
      console.log(router, 7444);
      router.push("doc/" + name);
    };
    return { menuVisible, close, to };
  },
};
</script>
<style lang="scss" scoped>
.content {
  display: flex;
  padding-top: 60px;
  padding-left: 285px;
}
aside {
  position: fixed;
  top: 0;
  left: 0;
  width: 285px;
  height: 110vh;
  padding: 100px 0 16px;
  background: #fff;
  box-shadow: 5px 0 5px rgb(51 51 51 / 10%);
  z-index: 1;
  transition: 0.4s cubic-bezier(0.68, 0.18, 0.53, 0.18) 0.1s;
  > h1 {
    padding-left: 40px;
  }
  > ol {
    font-size: 16px;
    color: #6f2e6a;
    line-height: 40px;
    display: block;
    margin-block-start: 1em;
    margin-block-end: 1em;
    margin-inline-start: 0px;
    margin-inline-end: 0px;
    padding-inline-start: 40px;
    cursor: pointer;
    > li {
      font-size: 15px;
      margin-left: 15px;
    }
  }
}
main {
  padding: 38px 20px;
  width: 90%;
}
@media (max-width: 500px){
  main {
    overflow: auto;
    padding: 20px 8px;
    margin: 0 auto;
  }
  .content {
    padding-left: 0px;
  }
  aside > ol > li .router-link-active {
    border-right: none;
  }
}
aside > ol > li > a {
  position: relative;
  height: 40px;
  color: #6f2e6a;
  display: block;
  padding: 4px 0px;
  text-decoration: none;
  font-weight: bold;
}
.router-link-active {
  background: #dcd0ff;
  // color: #fff;
  border-right: 3px solid #dcd0ff;
  @media (min-width: 500px) {
    border-right: none;
    &::after {
      content: "";
      display: block;
      animation: bdrolate 0.8s;
      position: absolute;
      top: 0;
      right: 0;
      width: 3px;
      height: 47px;
      background-color: #e0b0ff;
    }
  }
}
@keyframes bdrolate {
  0% {
    transform: rotateX(90deg);
  }
  100% {
    transform: rotateX(0deg);
  }
}
</style>
